home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Tools / Preditor 2.0 / Preditor Folder / PCMD Source / MPW / SoundPlay.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-02  |  993 b   |  46 lines  |  [TEXT/TCEd]

  1. /************************************************************
  2.  
  3.     SoundPlay.c
  4.     Last Modified: Friday, May 31, 1991 at 9:46 PM
  5.     
  6.     Attempt to play all 'snd ' resources given text for each
  7.     line selected (or all text if no selection)
  8.  
  9.     © Copyright Evatac Software  1988-1990
  10.     All rights reserved
  11.  
  12. ************************************************************/
  13.  
  14. #include "PCMD.h"
  15. #include <Resources.h>
  16. #include <Memory.h>
  17. #include <Sound.h>
  18.  
  19. main(
  20.     unsigned char        *sourceText,
  21.     long                sourceLength,
  22.     unsigned char        *destText,
  23.     long                *destSpace,
  24.     PCMDInfo            *info
  25.     )
  26. {
  27. #pragma unused(destText)
  28. #pragma unused(destSpace)
  29. #pragma unused(info)
  30.  
  31.     Handle        theSound;
  32.     char        soundName[34];
  33.     
  34.     if (sourceLength > 31)
  35.         sourceLength = 31;
  36.     BlockMove(sourceText, soundName + 1, sourceLength);
  37.     *soundName = (char) sourceLength;
  38.     
  39.     theSound = GetNamedResource('snd ', soundName);
  40.     if (theSound != NULL) {
  41.         SndPlay(NULL, theSound, FALSE);
  42.         ReleaseResource(theSound);
  43.     }
  44.     return(kPCMDSuccess);
  45. }
  46.